#Use a sigmoid function to compute the 
import numpy as np 
from matplotlib import pyplot as plt

length_of_season = 85
def evaluate_sigmoid_function(par_a, par_b, argument):
    return 1/(1+np.exp(-par_a*(argument-par_b)))




def evaluate_LAI_factor(par_a, par_b, j):
    LAI_factor = []
    for i in range(length_of_season):
        LAI_factor.append(evaluate_sigmoid_function(0.8, 25, i))
        pass
    
    LAI_factor = np.array(LAI_factor)    
    plt.plot(np.round(LAI_factor, 2))
    
    return np.round(LAI_factor, 2)    

#pars_a = np.array([0.5, 0.6, 0.7, 0.8])
#pars_b = np.array([25, 27, 29, 31])


num_of_season = 3*900
LAI_factors_season = np.zeros(int(num_of_season*length_of_season))

for i in range(num_of_season):
    par_a = np.random.choice([0.5,0.6,0.7,0.8])
    par_b = np.random.choice([25, 27, 29, 31]) 
    print(par_a)
    print(par_b)
    LAI_factors_season[int(i*length_of_season):int((i+1)*length_of_season)] = evaluate_LAI_factor(par_a, par_b, i)
    pass

#Save the LAI Factors
np.savetxt("LAI_factors.txt", LAI_factors_season)